#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
@File    :   request_utils.py
@Time    :   2024/12/03 23:31:54
@Author  :   xiangyu Chen
@Version :   1.0
@Contact :   yu112yu@sina.com
@License :   (C)Copyright 2017-2018, Liugroup-NLPR-CASIA
@Desc    :   None
'''

import requests


class RequestHandler:
    def __init__(self):
        """session管理器:维持会话"""
        self.session = requests.session()

    def httpcore(self, method, url, params=None, data=None, json=None, headers=None, **kwargs):
        return self.session.request(method, url, params=params, data=data, json=json, headers=headers, **kwargs)

    def close_session(self):
        """关闭session"""
        self.session.close()
